#ifndef _CNF_MEM_ALLOC_H        
#define _CNF_MEM_ALLOC_H    

/*======================== INCLUDES ===============================*/

#include "stdint.h"

#include "common_cfg.h"

#include "typedefs.h"

/*========================  DEFINES ===============================*/

/* Number of max pages in Far memory allocation   */
#define    MEM_ALLOC_MAX_FAR_RAM_PAGES              (uint8_t)0x02u
/* Number of max pages for near memory allocation */
#define    MEM_ALLOC_MAX_NEAR_RAM_PAGES             (uint8_t)0x01u

/*========================  MACROS  ===============================*/

/*======================== TYPEDEFS ===============================*/

/* Data type for the pages ID */
typedef enum 
{
    RAM_F0,
    RAM_F1,
    RAM_F2,
    RAM_F3,
    RAM_F4,
    RAM_F5,
    RAM_F6,
    RAM_F7,
    RAM_F8,
    RAM_F9,
    RAM_FA,
    RAM_FB,
    RAM_FC,
    RAM_FD,
    RAM_FE,
    RAM_FF,
    RAM_NULL,
}Mem_RamPagesType;

/* Data type for Far pointer  */
typedef uint8_t * __rptr tu8Ptr_Far;

typedef struct 
{
    Mem_RamPagesType        RamPageId;
    tu8Ptr_Far            ptr_StartAddress;
    tu8Ptr_Far            ptr_EndAddress;
}Mem_RamPages_config;

typedef struct 
{
    uint8_t                           u8Number_of_RAM_pages;
    const Mem_RamPages_config *   ptr_PagedRAMpages_config;
}MemAlloc_ConfigType;

/* Data type for Near Pointer (just a normal pointer) */
typedef uint8_t * tu8Ptr_Near;

typedef struct 
{
    Mem_RamPagesType              RamPageId;
    tu8Ptr_Near                 ptr_nearStartAddress;
    tu8Ptr_Near                 ptr_nearEndAddress;
}NearRAMpagesCfgType;

typedef struct 
{
    uint8_t                         u8Number_of_RAM_pages;
    const NearRAMpagesCfgType *    ptr_NearRAMpages_config;
}NearMemAlloc_ConfigType;


/*========================  EXTERNS ===============================*/

extern const MemAlloc_ConfigType  DynamicMemAlloc_config[];

const NearMemAlloc_ConfigType  NearMemAlloc_config[];

#endif /* __CNF_MEM_ALLOC_H */ 